package com.company.service.impl.compute;

import com.company.service.Compute;

public class UseCompute {
    public void useCom(Compute com, int one, int two){
        int result = 0;
        if (com instanceof Add)  {
            Add a = (Add)com;
            result = a.computer(one,two);
        } else if (com instanceof Sub) {
            Sub s = (Sub) com;
            result = s.computer(one,two);
        } else if (com instanceof Mul) {
            Mul m = (Mul) com;
            result = m.computer(one,two);
        } else if (com instanceof Div) {
            Div d = (Div) com;
            result = d.computer(one,two);
        }
        System.out.println(result);
    }
}
